﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Caliburn.Micro;

namespace TestWpfCaliburn.Views;

public class DynamicTableViewModel : Screen
{
    public DynamicTableViewModel()
    {
        Entries = new DataTable()
        {
            Columns =
            {
                new DataColumn("DrHead", typeof(string)),
                new DataColumn("CrHead", typeof(string)),
                new DataColumn("DrAmount", typeof(int)),
                new DataColumn("CrAmount", typeof(int)),
            }
        };
        for (int i = 0; i < 5; i++)
        {
            Entries.Rows.Add("Dr", "Cr", 100, 200);
        }
    }

    //public BindableCollection<object> DataItems { get; } = new();
    public DataTable Entries { get; }

    public void EntriesSelectionChanged(object item)
    {
        Trace.TraceInformation($"EntriesSelectionChanged() ${item}");
        if (item is not DataRowView row)
        {
            return;
        }
    }
}